package org.weasel.dummytests;

import org.jdom.Element;
import org.weasel.business.Utilities;
import org.weasel.data.XMLManager;

/**
 * Just for the purpose of testing the writing and reading from
 * the XML file - for Juri UnitTest Problems
 * @author user01
 *
 */
public class XMLTester {
	
	
	public static void main(String[] args) throws Exception {
		String fileLoc = "XMLManagerTestXML.xml";
		boolean out = false;
		
		for(int j=0; j<10; j++){
			XMLManager writer = new XMLManager(fileLoc);
			writer.createRootElement("root");
			
			for(int i=0; i<100; i++){
				Element e = new Element("item");
				Element num = new Element("number");
				num.setText(String.valueOf(i));
				e.addContent(num);
				
				writer.addElement(writer.getRootElement(), e);
				if(out) System.out.println("Element write " + i);
				writer.writeToFile();
			}
			
			Utilities.deleteFile(fileLoc);
		}
		
		System.out.println("Terminated");
		
		
	}
}
